package com.aaa.service.impl;

import com.aaa.mapper.StudentMapper;
import com.aaa.pojo.Student;
import com.aaa.service.StudentService;
import com.aaa.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
   private StudentMapper studentMapper;
    @Override
    public Result queryById(Integer sid) {
        Student byId = studentMapper.findById(sid);
        return new Result(200,"查询学生信息",byId);
    }

    @Override
    public Result queryAll() {
        List<Student> byId2 = studentMapper.findAll();
        return new Result(200,"查询学生信息班级" ,byId2);
    }

    @Override
    public Result querysave(Student student) {
        Integer save = studentMapper.save(student);
        return new Result(200,"添加数据成功",save);
    }

    @Override
    public Result querydelete(Integer sid) {
        Integer delete = studentMapper.delete(sid);
        return new Result(200,"删除数据成功",delete);
    }

    @Override
    public Result queryupdate(Student student) {
        Integer update = studentMapper.update(student);
        return new Result(200,"修改成功",update);
    }
}
